﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Specialized;

namespace MigratorCore.Bases
{
    public sealed class Settings : NameObjectCollectionBase
    {
        /// <summary>
        /// Default Constructor
        /// </summary>
        public Settings()
        {
            this.Clear();
        }

        /// <summary>
        /// Get a Setting
        /// </summary>
        /// <param name="name">Name of the Setting</param>
        /// <returns>Value of the Setting</returns>
        /// <value>Value of the Setting</value>
        public object this[string name]
        {
            get { return this.BaseGet(name); }
            set { this.BaseSet(name, value); }
        }

        /// <summary>
        /// Get a Setting from the index
        /// </summary>
        /// <param name="index">Index of the Setting</param>
        /// <returns>Value of the Setting</returns>
        /// <value>Value of the Setting</value>
        public object this[int index]
        {
            get { return this.BaseGet(index); }
            set { this.BaseSet(index, value); }
        }

        /// <summary>
        /// Add a Setting to the list
        /// </summary>
        /// <param name="name">Name of the Setting</param>
        /// <param name="value">Value of the Setting</param>
        public void Add(string name, object value)
        {
            this.BaseAdd(name, value);
        }

        /// <summary>
        /// Clears the List of Settings
        /// </summary>
        public void Clear()
        {
            this.BaseClear();
        }

        /// <summary>
        /// Gets a Setting
        /// </summary>
        /// <param name="name">Name of the Setting</param>
        public object Get(string name)
        {
            return this.BaseGet(name);
        }
        /// <summary>
        /// Gets a Setting
        /// </summary>
        /// <param name="index">Index of the Setting</param>
        public object Get(int index)
        {
            return this.BaseGet(index);
        }

        /// <summary>
        /// Remove a Setting
        /// </summary>
        /// <param name="name">Name of the Setting</param>
        public void Remove(string name)
        {
            this.BaseRemove(name);
        }

        /// <summary>
        /// Remove a Setting
        /// </summary>
        /// <param name="index">Index of a setting</param>
        public void RemoveAt(int index)
        {
            this.BaseRemoveAt(index);
        }

        /// <summary>
        /// Set/Update a Setting
        /// </summary>
        /// <param name="name">Name of the Setting</param>
        /// <param name="value">New Value of the Setting</param>
        public void Set(string name, object value)
        {
            this.BaseSet(name, value);
        }
        /// <summary>
        /// Set/Update a Setting
        /// </summary>
        /// <param name="index">Index of the Setting</param>
        /// <param name="value">New Value of the Setting</param>
        public void Set(int index, object value)
        {
            this.BaseSet(index, value);
        }


    }
}
